// 创建人员
// Depends on tencentcloud-sdk-nodejs version 4.0.3 or higher
const tencentcloud = require("tencentcloud-sdk-nodejs");

const IaiClient = tencentcloud.iai.v20200303.Client;

const clientConfig = {
  credential: {
    secretId: "AKIDSUKxMWVL0b8bw4zfCYryAE4ez4vWr78t",
    secretKey: "YqtlXDy7ESipiPt9D9wVrCLGxQlunTff",
  },
  region: "ap-beijing",
  profile: {
    httpProfile: {
      endpoint: "iai.tencentcloudapi.com",
    },
  },
};

const client = new IaiClient(clientConfig);
// const params = {
//     "GroupId": "star",
//     "PersonName": "张杰",
//     "PersonId": "zhangjie",
//     "Gender": 1,
//     "PersonExDescriptionInfos": [
//         {
//             "PersonExDescriptionIndex": 0,
//             "PersonExDescription": "唱歌的"
//         },
//         {
//             "PersonExDescriptionIndex": 1,
//             "PersonExDescription": "谢娜的老公"
//         },
//         {
//             "PersonExDescriptionIndex": 2,
//             "PersonExDescription": "《天下》《逆战》"
//         }
//     ],
//     "Url": "https://img1.baidu.com/it/u=3791886452,159794340&fm=253&fmt=auto&app=120&f=JPEG?w=550&h=550"
// };
const params = {
  "GroupId": "star",
  "PersonName": "刘亦菲",
  "PersonId": "liuyifei",
  "Gender": 2,
  "PersonExDescriptionInfos": [
      {
          "PersonExDescriptionIndex": 0,
          "PersonExDescription": "演员"
      },
      {
          "PersonExDescriptionIndex": 1,
          "PersonExDescription": "真漂亮"
      },
      {
          "PersonExDescriptionIndex": 2,
          "PersonExDescription": "《神雕侠侣》《梦华录》"
      }
  ],
  "Url": "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fnimg.ws.126.net%2F%3Furl%3Dhttp%253A%252F%252Fdingyue.ws.126.net%252F2022%252F0616%252F96759e84j00rdkqe8003ld000oe00z5p.jpg%26thumbnail%3D660x2147483647%26quality%3D80%26type%3Djpg&refer=http%3A%2F%2Fnimg.ws.126.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1659517739&t=4a43ab897aedcfbe6110e0765002278c"
};
client.CreatePerson(params).then(
  (data) => {
    console.log(data);
  },
  (err) => {
    console.error("error", err);
  }
);